package com.yj.lottery_system.common.exception;

import com.yj.lottery_system.common.errorcode.ErrorCode;
import lombok.Data;
import lombok.EqualsAndHashCode;

@Data
@EqualsAndHashCode(callSuper = true)
public class ControllerException extends RuntimeException {
    //异常码
    private Integer code;
    //异常信息
    private String msg;

    //序列化使用
    public ControllerException() {
    }

    public ControllerException(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }
    public ControllerException(ErrorCode errorCode) {
        this.code = errorCode.getCode();
        this.msg = errorCode.getMsg();
    }

}
